package cn.wsh.org.controller;

import cn.wsh.MyLog;
import cn.wsh.basic.util. AjaxResult;
import cn.wsh.basic.util.PageList;
import cn.wsh.org.domain.Employee;
import cn.wsh.org.query.EmployeeQuery;
import cn.wsh.org.service.IEmployeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName : EmployeeController
 * Author : "吴----"
 * @date : 2022/1/24 7:57
 */


@Slf4j
@RestController// = @Controller + @ResponseBody
@RequestMapping("/employee")// http://localhost:8080/dept

@Api(value = "员工的API", description = "员工相关的CRUD功能")
public class EmployeeController {
    @Autowired
    private IEmployeeService employeeService;

    @MyLog(value = "获取一条记录  get  /1")
    //获取一条记录  get  /1
    @GetMapping("/{id}")// http://localhost:8080/dept/2
    public Employee queryById(@PathVariable("id") Long id) {
        return employeeService.queryById(id);
    }

    @MyLog(value = "获取所有数据  get")
    //获取所有数据  get
    @GetMapping// http://localhost:8080/dept
    public List<Employee> queryAll() {
        return employeeService.queryAll();
    }


}
